<?php

namespace app\model;

use app\BaseModel;
use think\model\relation\BelongsTo;
use app\model\not_del\RatingScaleModel as NotDelRatingScaleModel;

/**
 * 心理咨询-线下测评任务
 */
class ConsultOfflineTaskModel extends BaseModel
{
    protected $name = 'consult_offline_task';

    /**
     * 关联量表
     * @return BelongsTo
     */
    public function RatingScale(): BelongsTo
    {
        return $this->belongsTo(NotDelRatingScaleModel::class, 'rating_scale_id')->bind([
            'rating_scale_name' => 'name',
            'rating_scale_cover' => 'cover'
        ]);
    }

    /**
     * 关联线下预约任务测评结果
     * @return BelongsTo
     */
    public function ConsultOfflineResult(): BelongsTo
    {
        return $this->belongsTo(ConsultOfflineResultModel::class, 'result_id')->bind([
            'is_follow',
        ]);
    }

    public function ConsultOffline(): BelongsTo
    {
        return $this->belongsTo(ConsultOfflineModel::class, 'offline_id')->bind([
            'consult_id',
            'uid'
        ]);
    }
}